package com.doit.day01;

import org.apache.commons.lang3.RandomUtils;
import redis.clients.jedis.Jedis;

import java.util.UUID;

public class _04_生产者 {
    public static void main(String[] args) throws InterruptedException {
        Jedis jedis = _03_redis的客户端.getJedis();
        while (true){
            UUID taskId = UUID.randomUUID();
            jedis.lpush("producer", taskId.toString());
            Thread.sleep(RandomUtils.nextInt(100,300));

            if (jedis.llen("producer") >= 10){
                Thread.sleep(RandomUtils.nextInt(1000,3000));
            }
        }




    }
}
